<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - id:000977,sync:fuzzer2,src:001052.lcov_info_final - test/gmock-1.7.0/src/gmock.cc</title>
  <link rel="stylesheet" type="text/css" href="../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../../index.html">top level</a> - <a href="index.html">test/gmock-1.7.0/src</a> - gmock.cc<span style="font-size: 80%;"> (source / <a href="gmock.cc.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">id:000977,sync:fuzzer2,src:001052.lcov_info_final</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">40</td>
            <td class="headerCovTableEntryLo">0.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2016-03-13 10:42:47</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">9</td>
            <td class="headerCovTableEntryLo">0.0 %</td>
          </tr>
          <tr><td><img src="../../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : // Copyright 2008, Google Inc.</a>
<span class="lineNum">       2 </span>            : // All rights reserved.
<span class="lineNum">       3 </span>            : //
<span class="lineNum">       4 </span>            : // Redistribution and use in source and binary forms, with or without
<span class="lineNum">       5 </span>            : // modification, are permitted provided that the following conditions are
<span class="lineNum">       6 </span>            : // met:
<span class="lineNum">       7 </span>            : //
<span class="lineNum">       8 </span>            : //     * Redistributions of source code must retain the above copyright
<span class="lineNum">       9 </span>            : // notice, this list of conditions and the following disclaimer.
<span class="lineNum">      10 </span>            : //     * Redistributions in binary form must reproduce the above
<span class="lineNum">      11 </span>            : // copyright notice, this list of conditions and the following disclaimer
<span class="lineNum">      12 </span>            : // in the documentation and/or other materials provided with the
<span class="lineNum">      13 </span>            : // distribution.
<span class="lineNum">      14 </span>            : //     * Neither the name of Google Inc. nor the names of its
<span class="lineNum">      15 </span>            : // contributors may be used to endorse or promote products derived from
<span class="lineNum">      16 </span>            : // this software without specific prior written permission.
<span class="lineNum">      17 </span>            : //
<span class="lineNum">      18 </span>            : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
<span class="lineNum">      19 </span>            : // &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
<span class="lineNum">      20 </span>            : // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
<span class="lineNum">      21 </span>            : // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
<span class="lineNum">      22 </span>            : // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
<span class="lineNum">      23 </span>            : // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
<span class="lineNum">      24 </span>            : // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
<span class="lineNum">      25 </span>            : // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
<span class="lineNum">      26 </span>            : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
<span class="lineNum">      27 </span>            : // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<span class="lineNum">      28 </span>            : // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<span class="lineNum">      29 </span>            : //
<span class="lineNum">      30 </span>            : // Author: wan@google.com (Zhanyong Wan)
<span class="lineNum">      31 </span>            : 
<span class="lineNum">      32 </span>            : #include &quot;gmock/gmock.h&quot;
<span class="lineNum">      33 </span>            : #include &quot;gmock/internal/gmock-port.h&quot;
<span class="lineNum">      34 </span>            : 
<span class="lineNum">      35 </span>            : namespace testing {
<span class="lineNum">      36 </span>            : 
<span class="lineNum">      37 </span>            : // TODO(wan@google.com): support using environment variables to
<span class="lineNum">      38 </span>            : // control the flag values, like what Google Test does.
<span class="lineNum">      39 </span>            : 
<span class="lineNum">      40 </span>            : GMOCK_DEFINE_bool_(catch_leaked_mocks, true,
<span class="lineNum">      41 </span>            :                    &quot;true iff Google Mock should report leaked mock objects &quot;
<span class="lineNum">      42 </span>            :                    &quot;as failures.&quot;);
<span class="lineNum">      43 </span>            : 
<span class="lineNum">      44 </span><span class="lineNoCov">          0 : GMOCK_DEFINE_string_(verbose, internal::kWarningVerbosity,</span>
<span class="lineNum">      45 </span>            :                      &quot;Controls how verbose Google Mock's output is.&quot;
<span class="lineNum">      46 </span>            :                      &quot;  Valid values:\n&quot;
<span class="lineNum">      47 </span>            :                      &quot;  info    - prints all messages.\n&quot;
<span class="lineNum">      48 </span>            :                      &quot;  warning - prints warnings and errors.\n&quot;
<span class="lineNum">      49 </span>            :                      &quot;  error   - prints errors only.&quot;);
<span class="lineNum">      50 </span>            : 
<span class="lineNum">      51 </span>            : namespace internal {
<span class="lineNum">      52 </span>            : 
<span class="lineNum">      53 </span>            : // Parses a string as a command line flag.  The string should have the
<span class="lineNum">      54 </span>            : // format &quot;--gmock_flag=value&quot;.  When def_optional is true, the
<span class="lineNum">      55 </span>            : // &quot;=value&quot; part can be omitted.
<a name="56"><span class="lineNum">      56 </span>            : //</a>
<span class="lineNum">      57 </span>            : // Returns the value of the flag, or NULL if the parsing failed.
<span class="lineNum">      58 </span><span class="lineNoCov">          0 : static const char* ParseGoogleMockFlagValue(const char* str,</span>
<span class="lineNum">      59 </span>            :                                             const char* flag,
<span class="lineNum">      60 </span>            :                                             bool def_optional) {
<span class="lineNum">      61 </span>            :   // str and flag must not be NULL.
<span class="lineNum">      62 </span><span class="lineNoCov">          0 :   if (str == NULL || flag == NULL) return NULL;</span>
<span class="lineNum">      63 </span>            : 
<span class="lineNum">      64 </span>            :   // The flag must start with &quot;--gmock_&quot;.
<span class="lineNum">      65 </span><span class="lineNoCov">          0 :   const std::string flag_str = std::string(&quot;--gmock_&quot;) + flag;</span>
<span class="lineNum">      66 </span><span class="lineNoCov">          0 :   const size_t flag_len = flag_str.length();</span>
<span class="lineNum">      67 </span><span class="lineNoCov">          0 :   if (strncmp(str, flag_str.c_str(), flag_len) != 0) return NULL;</span>
<span class="lineNum">      68 </span>            : 
<span class="lineNum">      69 </span>            :   // Skips the flag name.
<span class="lineNum">      70 </span><span class="lineNoCov">          0 :   const char* flag_end = str + flag_len;</span>
<span class="lineNum">      71 </span>            : 
<span class="lineNum">      72 </span>            :   // When def_optional is true, it's OK to not have a &quot;=value&quot; part.
<span class="lineNum">      73 </span><span class="lineNoCov">          0 :   if (def_optional &amp;&amp; (flag_end[0] == '\0')) {</span>
<span class="lineNum">      74 </span><span class="lineNoCov">          0 :     return flag_end;</span>
<span class="lineNum">      75 </span>            :   }
<span class="lineNum">      76 </span>            : 
<span class="lineNum">      77 </span>            :   // If def_optional is true and there are more characters after the
<span class="lineNum">      78 </span>            :   // flag name, or if def_optional is false, there must be a '=' after
<span class="lineNum">      79 </span>            :   // the flag name.
<span class="lineNum">      80 </span><span class="lineNoCov">          0 :   if (flag_end[0] != '=') return NULL;</span>
<span class="lineNum">      81 </span>            : 
<span class="lineNum">      82 </span>            :   // Returns the string after &quot;=&quot;.
<span class="lineNum">      83 </span><span class="lineNoCov">          0 :   return flag_end + 1;</span>
<span class="lineNum">      84 </span>            : }
<span class="lineNum">      85 </span>            : 
<span class="lineNum">      86 </span>            : // Parses a string for a Google Mock bool flag, in the form of
<span class="lineNum">      87 </span>            : // &quot;--gmock_flag=value&quot;.
<span class="lineNum">      88 </span>            : //
<a name="89"><span class="lineNum">      89 </span>            : // On success, stores the value of the flag in *value, and returns</a>
<span class="lineNum">      90 </span>            : // true.  On failure, returns false without changing *value.
<span class="lineNum">      91 </span><span class="lineNoCov">          0 : static bool ParseGoogleMockBoolFlag(const char* str, const char* flag,</span>
<span class="lineNum">      92 </span>            :                                     bool* value) {
<span class="lineNum">      93 </span>            :   // Gets the value of the flag as a string.
<span class="lineNum">      94 </span><span class="lineNoCov">          0 :   const char* const value_str = ParseGoogleMockFlagValue(str, flag, true);</span>
<span class="lineNum">      95 </span>            : 
<span class="lineNum">      96 </span>            :   // Aborts if the parsing failed.
<span class="lineNum">      97 </span><span class="lineNoCov">          0 :   if (value_str == NULL) return false;</span>
<span class="lineNum">      98 </span>            : 
<span class="lineNum">      99 </span>            :   // Converts the string value to a bool.
<span class="lineNum">     100 </span><span class="lineNoCov">          0 :   *value = !(*value_str == '0' || *value_str == 'f' || *value_str == 'F');</span>
<span class="lineNum">     101 </span><span class="lineNoCov">          0 :   return true;</span>
<span class="lineNum">     102 </span>            : }
<span class="lineNum">     103 </span>            : 
<span class="lineNum">     104 </span>            : // Parses a string for a Google Mock string flag, in the form of
<span class="lineNum">     105 </span>            : // &quot;--gmock_flag=value&quot;.
<span class="lineNum">     106 </span>            : //
<a name="107"><span class="lineNum">     107 </span>            : // On success, stores the value of the flag in *value, and returns</a>
<span class="lineNum">     108 </span>            : // true.  On failure, returns false without changing *value.
<span class="lineNum">     109 </span><span class="lineNoCov">          0 : static bool ParseGoogleMockStringFlag(const char* str, const char* flag,</span>
<span class="lineNum">     110 </span>            :                                       std::string* value) {
<span class="lineNum">     111 </span>            :   // Gets the value of the flag as a string.
<span class="lineNum">     112 </span><span class="lineNoCov">          0 :   const char* const value_str = ParseGoogleMockFlagValue(str, flag, false);</span>
<span class="lineNum">     113 </span>            : 
<span class="lineNum">     114 </span>            :   // Aborts if the parsing failed.
<span class="lineNum">     115 </span><span class="lineNoCov">          0 :   if (value_str == NULL) return false;</span>
<span class="lineNum">     116 </span>            : 
<span class="lineNum">     117 </span>            :   // Sets *value to the value of the flag.
<span class="lineNum">     118 </span><span class="lineNoCov">          0 :   *value = value_str;</span>
<span class="lineNum">     119 </span><span class="lineNoCov">          0 :   return true;</span>
<span class="lineNum">     120 </span>            : }
<span class="lineNum">     121 </span>            : 
<span class="lineNum">     122 </span>            : // The internal implementation of InitGoogleMock().
<span class="lineNum">     123 </span>            : //
<span class="lineNum">     124 </span>            : // The type parameter CharType can be instantiated to either char or
<a name="125"><span class="lineNum">     125 </span>            : // wchar_t.</a>
<span class="lineNum">     126 </span>            : template &lt;typename CharType&gt;
<span class="lineNum">     127 </span><span class="lineNoCov">          0 : void InitGoogleMockImpl(int* argc, CharType** argv) {</span>
<span class="lineNum">     128 </span>            :   // Makes sure Google Test is initialized.  InitGoogleTest() is
<span class="lineNum">     129 </span>            :   // idempotent, so it's fine if the user has already called it.
<span class="lineNum">     130 </span><span class="lineNoCov">          0 :   InitGoogleTest(argc, argv);</span>
<span class="lineNum">     131 </span><span class="lineNoCov">          0 :   if (*argc &lt;= 0) return;</span>
<span class="lineNum">     132 </span>            : 
<span class="lineNum">     133 </span><span class="lineNoCov">          0 :   for (int i = 1; i != *argc; i++) {</span>
<span class="lineNum">     134 </span><span class="lineNoCov">          0 :     const std::string arg_string = StreamableToString(argv[i]);</span>
<span class="lineNum">     135 </span><span class="lineNoCov">          0 :     const char* const arg = arg_string.c_str();</span>
<span class="lineNum">     136 </span>            : 
<span class="lineNum">     137 </span>            :     // Do we see a Google Mock flag?
<span class="lineNum">     138 </span><span class="lineNoCov">          0 :     if (ParseGoogleMockBoolFlag(arg, &quot;catch_leaked_mocks&quot;,</span>
<span class="lineNum">     139 </span>            :                                 &amp;GMOCK_FLAG(catch_leaked_mocks)) ||
<span class="lineNum">     140 </span><span class="lineNoCov">          0 :         ParseGoogleMockStringFlag(arg, &quot;verbose&quot;, &amp;GMOCK_FLAG(verbose))) {</span>
<span class="lineNum">     141 </span>            :       // Yes.  Shift the remainder of the argv list left by one.  Note
<span class="lineNum">     142 </span>            :       // that argv has (*argc + 1) elements, the last one always being
<span class="lineNum">     143 </span>            :       // NULL.  The following loop moves the trailing NULL element as
<span class="lineNum">     144 </span>            :       // well.
<span class="lineNum">     145 </span><span class="lineNoCov">          0 :       for (int j = i; j != *argc; j++) {</span>
<span class="lineNum">     146 </span><span class="lineNoCov">          0 :         argv[j] = argv[j + 1];</span>
<span class="lineNum">     147 </span>            :       }
<span class="lineNum">     148 </span>            : 
<span class="lineNum">     149 </span>            :       // Decrements the argument count.
<span class="lineNum">     150 </span><span class="lineNoCov">          0 :       (*argc)--;</span>
<span class="lineNum">     151 </span>            : 
<span class="lineNum">     152 </span>            :       // We also need to decrement the iterator as we just removed
<span class="lineNum">     153 </span>            :       // an element.
<span class="lineNum">     154 </span><span class="lineNoCov">          0 :       i--;</span>
<span class="lineNum">     155 </span>            :     }
<span class="lineNum">     156 </span>            :   }
<span class="lineNum">     157 </span>            : }
<span class="lineNum">     158 </span>            : 
<span class="lineNum">     159 </span>            : }  // namespace internal
<span class="lineNum">     160 </span>            : 
<span class="lineNum">     161 </span>            : // Initializes Google Mock.  This must be called before running the
<span class="lineNum">     162 </span>            : // tests.  In particular, it parses a command line for the flags that
<span class="lineNum">     163 </span>            : // Google Mock recognizes.  Whenever a Google Mock flag is seen, it is
<span class="lineNum">     164 </span>            : // removed from argv, and *argc is decremented.
<span class="lineNum">     165 </span>            : //
<span class="lineNum">     166 </span>            : // No value is returned.  Instead, the Google Mock flag variables are
<span class="lineNum">     167 </span>            : // updated.
<span class="lineNum">     168 </span>            : //
<span class="lineNum">     169 </span>            : // Since Google Test is needed for Google Mock to work, this function
<a name="170"><span class="lineNum">     170 </span>            : // also initializes Google Test and parses its flags, if that hasn't</a>
<span class="lineNum">     171 </span>            : // been done.
<span class="lineNum">     172 </span><span class="lineNoCov">          0 : GTEST_API_ void InitGoogleMock(int* argc, char** argv) {</span>
<span class="lineNum">     173 </span><span class="lineNoCov">          0 :   internal::InitGoogleMockImpl(argc, argv);</span>
<span class="lineNum">     174 </span><span class="lineNoCov">          0 : }</span>
<span class="lineNum">     175 </span>            : 
<a name="176"><span class="lineNum">     176 </span>            : // This overloaded version can be used in Windows programs compiled in</a>
<span class="lineNum">     177 </span>            : // UNICODE mode.
<span class="lineNum">     178 </span><span class="lineNoCov">          0 : GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv) {</span>
<span class="lineNum">     179 </span><span class="lineNoCov">          0 :   internal::InitGoogleMockImpl(argc, argv);</span>
<a name="180"><span class="lineNum">     180 </span><span class="lineNoCov">          0 : }</span></a>
<span class="lineNum">     181 </span>            : 
<span class="lineNum">     182 </span><span class="lineNoCov">          0 : }  // namespace testing</span>
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.11</a></td></tr>
  </table>
  <br>

</body>
</html>
